<!doctype html>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<title>Add Organisation</title>
<meta name="description" content="">
<meta name="author" content="">

<!-- Combined stylesheets load -->
<!-- Load either 960.gs.fluid or 960.gs to toggle between fixed and fluid layout -->
<link href="css/main.css" rel="stylesheet" type="text/css">

<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/png" href="favicon-large.png">
<script src="js/index.js"></script>
<script src="js/jquery.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/jstab.js"></script>
<script>
	$(document).ready(function() {
		$("#tablepaging").tablesorter();
		$("#tabs").tabs();	
	});

	function showTab3() {
		$("#btnTabs-3").show();
	}
	function hideTab3() {
		$("#btnTabs-3").hide();
	}
	function showTab4() {
		$("#btnTabs-4").show();
	}
	function hideTab4() {
		$("#btnTabs-4").hide();
	}
	function showTab5() {
		$("#btnTabs-5").show();
	}
	function hideTab5() {
		$("#btnTabs-5").hide();
	}
	function showTab6() {
		$("#btnTabs-6").show();
	}
	function hideTab6() {
		$("#btnTabs-6").hide();
	}
</script>

</head>

<body>
	<!-- Header -->

	<!-- Server status -->
	<header></header>
	<!-- End server status -->

	<!-- Main nav -->
	<%@include file='header.jsp'%>	

	
	<!-- End status bar -->

	<div id="header-shadow"></div>
	<!-- End header -->

	<!-- Always visible control bar -->
	<div id="control-bar" class="grey-bg clearfix">
		<div class="container_12"></div>
	</div>
	<!-- End control bar -->

	<!-- Content -->
	<article class="container_12">


		<section class="grid_8">
			<div class="block-border">
			<form class="block-content form" name="f1" method="post"
							action="add_org.action">
				<h1>Add Organisation</h1>

				<div class="block-controls"></div>


				<div class="columns">

					<div id="tabs">

						<ul class="tabs js-tabs same-height">
							<li><a href="#tabs-1">Details 1</a></li>
							<li><a href="#tabs-2">Details 2</a></li>
							<li><a href="#tabs-3" id="btnTabs-3">Details 3</a></li>
							<li><a href="#tabs-4" id="btnTabs-4">Details 4</a></li>
							<li><a href="#tabs-5" id="btnTabs-5" onclick="doAction('/listSPM!listSupportMaterial')">Details 5</a></li>
							<li><a href="#tabs-6" id="btnTabs-6">BU/Directorates</a></li>
						</ul>
						
							<div class="float-right" style="margin: -2.5em 2em 0 0;">

								<a class="button" onclick="ValidateData()"
									style="cursor: pointer"> <span class="smaller"> <img
										height="16" width="16"
										src="images/icons/fugue/tick-circle.png"> <strong>SAVE</strong></span>
								</a> <a class="button" title="Logout" href="ListOrganisation.jsp">
									<span class="smaller"><img height="16" width="16"
										src="images/icons/fugue/navigation-180.png"><strong>
											BACK </strong></span>
								</a>

							</div>

							<div class="tabs-content">

								<div id="tabs-1" style="height: 650px">
									<ul class="message warning no-margin">
										<li id="message">This is a <strong>warning
												message</strong>, inside a box
										</li>
										<li class="close-bt"></li>
									</ul>
									<!-- content tab 1 -->

									<div style="float: left; width: 48%">

										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">Organisation
												Name <font style="color: red">*</font>
											</label>
											<s:textfield name="org.organisationName"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>

										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">Organisation
												Short Description <font style="color: red">*</font>
											</label>
											<s:textarea name="org.shortDesc" cssClass="full-width"
												cssStyle="width: 240px;" rows="4" />
										</p>

										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">Lead
												Contact </label>
											<s:hidden id="lu.contactId" name="org.contactID"
												cssClass="full-width"
												cssStyle="width: 30px; margin-right: 5px; background: silver; " />
											<s:textfield id="lu.contactName" name="lu.contactName"
												cssClass="full-width"
												cssStyle="width: 180px; margin-right: 5px; background: silver; "
												disabled="true" />
											<a href=""
												onclick="return popitup('search.action?contact.firstName=&contact.surName=')">
												Lookup </a>
										</p>


										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">Address
												Line 1 <font style="color: red">*</font>
											</label>
											<s:textfield id="lu.address_line1" name="org.address1"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>


										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">Address
												Line 2</label>
											<s:textfield id="lu.address_line2" name="org.address2"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>
										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">Address
												Line 3</label>
											<s:textfield id="lu.address_line3" name="org.address3"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>

										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">PostCode
												<font style="color: red">*</font>
											</label>
											<s:textfield id="lu.postCode" name="org.postCode"
												cssClass="full-width"
												cssStyle="width: 180px; margin-right: 5px;" />
											<a href=""
												onclick="return popitup('add_lookup.action?address.postCode=&address.addressName=&address.townName=')">Lookup</a>
										</p>
										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label for="complex-en-url"
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">City/Town
											</label>
											<s:textfield id="lu.townName" name="org.townName"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>

										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label for="complex-en-url"
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">County</label>
											<s:textfield id="lu.countyName" name="org.countyName"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>
										<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label for="complex-en-url"
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">Nation/Country</label>

											<select id="lu.countryName" name="org.countryName" class="full-width"
												style="width: 210px;">
												<option value="">--Select a Country--</option>
												<option value="Philippines">Philippines</option>
												<option value="North Korea">North Korea</option>
												<option value="China">China</option>
												<option value="Thailand">Thailand</option>
												<option value="Happy Polla">Happy Polla</option>
											</select>
										</p>
									</div>
									<!-- right -->
									<div style="float: right; width: 48%">
										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 165px;">Preferred
												Origanisation</label>
											<!-- <input type="checkbox" name="stats-display[]"
												id="stats-display-0" value="0" style="margin: 8px 0 0 0;" /> -->
											<input type="checkbox" id="pre_org" name="org.preferredOrg"
												value="1" style="margin: 8px 0 0 0;" />
										</p>
										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label for="complex-en-subtitle"
												style="line-height: 30px; float: left; margin-right: 20px; width: 165px;">Expression
												of Interest </label> <input type="checkbox" id="exp_int"
												name="org.expOfInterest" value="1"
												style="margin: 8px 0 0 0;"
												onclick="if(this.checked) showTab3(); else hideTab3();" />
										</p>

										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label for="complex-en-subtitle"
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">Type
												of Bussiness <font style="color: red">*</font>
											</label>
											<s:hidden id="lu.typeOfBusinessID"
												name="org.typeOfBusinessID" cssClass="full-width"
												cssStyle="width: 180px; margin-right: 5px; background: silver; " />
											<s:textfield id="lu.businessName" name="org.businessName"
												cssClass="full-width"
												cssStyle="width: 180px; margin-right: 5px; background: silver; "
												disabled="true" />
											<a href=""
												onclick="return popitup('bus_lookup.action?business.businessName=&business.sicCode=')">Lookup</a>
										</p>


										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label for="complex-en-subtitle"
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">
												SIC Code </label>
											<s:textfield id="lu.sicCode" name="lu.sicCode"
												cssClass="full-width"
												cssStyle="width: 82px; background: silver; " disabled="true" />
										</p>

										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">
												Origanisation Full Description</label>
											<s:textarea name="org.fullDesc" cssClass="full-width"
												cssStyle="width: 240px;" rows="4" />

										</p>

										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">
												Phone Number <font style="color: red">*</font>
											</label>
											<s:textfield id="phoneNumber" name="org.phoneNumber"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>
										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">
												Fax</label>
											<s:textfield id="fax" name="org.fax" cssClass="full-width"
												cssStyle="width: 240px;" />
										</p>
										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label for="complex-en-subtitle"
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">
												Email</label>
											<s:textfield id="email" name="org.email"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>
										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label
												style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">
												Web Address</label>
											<s:textfield id="web_add" name="org.webAddress"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>
										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">
												Chairity Number</label>
											<s:textfield id="charity_no" name="org.charityNumber"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>
										<p class="colx2-right"
											style="width: 100%; margin-bottom: 10px;">
											<label style="line-height: 30px; float: left; margin-right: 20px; width: 150px;">
												Company Number</label>
											<s:textfield id="comp_no" name="org.companyNumber"
												cssClass="full-width" cssStyle="width: 240px;" />
										</p>
									</div>
									<!-- end content tab 1 -->

								</div>
								<div id="tabs-2">
									<table id="details2-add-table">
										<tbody>
											<tr>
												<td>Organisation Specicallism</td>

												<td><div class="list">
														<input type="checkbox" name="org.orgSpecicalism" value="Blink/Partially Sighted"/>Blink/Partially Sighted<br /> 
														<input type="checkbox" name="org.orgSpecicalism" value="Deaf/Hard of Hearing"/>Deaf/Hard of Hearing<br />
														<input type="checkbox" name="org.orgSpecicalism" value="Dyslexia"/>Dyslexia<br/>
														<input type="checkbox" name="org.orgSpecicalism" value="Learning Disability"/>Learning Disability<br /> 
														<input type="checkbox" name="org.orgSpecicalism" value="Mental Health"/>Mental Health<br />
													</div></td>


												<td>Service personal Circumstances Capabilities</td>

												<td><div class="list">
														<input type="checkbox" name="org.servicePerCirCap" value="Carer Responsibilities"/>Carer Responsibilities<br />
														<input type="checkbox" name="org.servicePerCirCap" value="Lone Parent"/>Lone Parent<br />

													</div></td>

											</tr>
											<tr>
												<td>Service Disablities Capabilities</td>
												<td>
													<div class="list">
														<input type="checkbox" name="org.serviceDisCap" value="Chest, Breathing problems"/>Chest, Breathing problems<br/>
														<input type="checkbox" name="org.serviceDisCap" value="Condition restricting mobility/dex"/>Condition restricting mobility/dex<br/> 
														<input type="checkbox" name="org.serviceDisCap" value="Diabetes"/>Diabetes<br/>
														<input type="checkbox" name="org.serviceDisCap" value="Difficulty in hearing"/>Difficulty in hearing<br/>
													</div>
												</td>
												<td>Service Ethnicity Capabilities</td>
												<td>
													<div class="list">
														<input type="checkbox" name="org.serviceEthCap" value="White British"/>White British<br/> 
														<input type="checkbox" name="org.serviceEthCap" value="White Irish"/>White Irish<br/> 
														<input type="checkbox" name="org.serviceEthCap" value="Other white"/>Other white<br/> 
														<input type="checkbox" name="org.serviceEthCap" value="White & Black Caribbean"/>White & Black Caribbean<br/> 
														<input type="checkbox" name="org.serviceEthCap" value="White & Black African"/>White & Black African<br/>
													</div>
												</td>
											</tr>
											<tr>
												<td>Service Barriers Capabilities</td>
												<td>
													<div class="list">
														<input type="checkbox" name="org.serviceBarCap" value="Lone Parent"/>Lone Parent<br/> 
														<input type="checkbox" name="org.serviceBarCap" value="ESOL"/>ESOL<br/> 
														<input type="checkbox" name="org.serviceBarCap" value="Refugee"/>Refugee<br/>
														<input type="checkbox" name="org.serviceBarCap" value="Basics skill"/>Basics skill<br/>
													</div>
												</td>
												<td>Accreditation</td>
												<td>
													<div class="list">
														<input type="checkbox" name="org.accreditation" value="Two ticks"/>Two ticks<br/> 
														<input type="checkbox" name="org.accreditation" value="Investor in people"/>Investor in people<br/> 
														<input type="checkbox" name="org.accreditation" value="ISO 9001"/>ISO 9001<br/> 
														<input type="checkbox" name="org.accreditation" value="ISO 14001"/>ISO 14001<br/> 
														<input type="checkbox" name="org.accreditation" value="ISO 27001"/>ISO 27001<br/>
													</div>
												</td>
											</tr>
											<tr>
												<td>Service Benefits Capabilities</td>
												<td>
													<div class="list">
														<input type="checkbox" name="org.serviceBenCap" value="Disablity Lingving Allowance"/>Disablity Lingving Allowance<br/>
														<input type="checkbox" name="org.serviceBenCap" value="Employment and Support Allowance"/>Employment and Support Allowance<br/>
														<input type="checkbox" name="org.serviceBenCap" value="Incapacity Benefit"/>Incapacity Benefit<br/> 
														<input type="checkbox" name="org.serviceBenCap" value="Income Support"/>Income Support<br>
													</div>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
								<div id="tabs-3">
									<table id="details3-add-table">
										<tr>
											<td>EOI Programmes</td>

											<td><div class="list">
													<input type="checkbox" name="org.eoiProgramme" value="Programme 1"/>Programme 1<br /> 
													<input type="checkbox" name="org.eoiProgramme" value="Programme 2"/>Programme 2<br />

												</div></td>
											<td></td>
											<td></td>
										</tr>

										<tr>
											<td>EOI Services</td>

											<td><div class="list">
													<input type="checkbox" name="org.eoiService" value="Service 1"/>Service 1<br /> 
													<input type="checkbox" name="org.eoiService" value="Service 1"/>Service 2<br /> 
													<input type="checkbox" name="org.eoiService" value="Service 1"/>Service 3<br /> 
												</div></td>
											<td></td>
											<td></td>
										</tr>

									</table>

								</div>
						</form>
						<div id="tabs-4">
							<fieldset style="height: 200px;">
								<legend>Premise</legend>
								<table id="tablepaging" class="table tablesorter">
									<thead>
										<tr>
											<th>Premise Name</th>
											<th>Address</th>
											<th>Primary Location</th>
											<th>Phone Number</th>
										</tr>
									</thead>
									<tbody>
										<!-- DATA WILL BE PRINTED HERE BY JAVASCRIPT -->
										<!-- DATA WILL BE PRINTED HERE BY JAVASCRIPT -->
									</tbody>
								</table>

							</fieldset>

							<fieldset id="fs1">
								<legend>Located In</legend>
								<table id="details4-add-table">
									<tr>
										<td>Ward:</td>
										<td><input type="text" disabled="disabled" /></td>
										<td>NHS Authority:</td>
										<td><input type="text" disabled="disabled" /></td>
									</tr>
									<tr>
										<td>Borough:</td>
										<td><input type="text" disabled="disabled" /></td>
										<td>Gov't Office Region:</td>
										<td><select>
												<option>Gov Off 1</option>
												<option>Gov Off 2</option>
												<option>Gov Off 3</option>
												<option>Gov Off 4</option>
										</select></td>
									</tr>

									<tr>
										<td>Local Authority:</td>
										<td><input type="text" disabled="disabled" /></td>
										<td>Trust Region:</td>
										<td><select>
												<option>Scotand</option>
												<option></option>
												<option></option>
												<option></option>
										</select></td>
									</tr>

									<tr>
										<td>Unitary Authority:</td>
										<td><input type="text" disabled="disabled" /></td>
										<td>Trust District:</td>
										<td><select>
												<option>Lancanshire</option>
												<option></option>
												<option></option>
												<option></option>
										</select></td>
									</tr>

								</table>
							</fieldset>
						</div>
						<div id="tabs-5">
						
							<div class="no-margin">
								<div style="text-align: right">
									<a class="button red" title="Add" href="AddSupportingMaterials.jsp">
										<span class="smaller">CREATE</span>
								
									</a> 
									<input type="checkbox" name="checkInclude" value="true"
										${ checkInclude ? "checked" : "" } /> <label
										for="table-display" style="display: inline">Include
										In-active</label>
								</div>
								<table class="table" id="tablepaging2" cellspacing="0"
									width="100%">
									<thead>
										<tr>
											<th scope="col">URL</th>
											<th scope="col">Description</th>
											<th scope="col">Type</th>
											<th scope="col">Active</th>
											<th scope="col">Added Date</th>
										</tr>
									</thead>
									<tbody>
										<s:iterator value="spmList" var="sup">
											<tr>
		
												<td><s:property value="URL" /></td>
												<td><s:property value="Description" /></td>
												<td><s:property value="Type" /></td>
												<td><s:property value="Active" /></td>
												<td><s:property value="AddedDate" /></td>
		
												
											</tr>
										</s:iterator>

									</tbody>
								</table>
							</div>
						
							<div class="block-footer" id="pageNavPosition2">
								<script type="text/javascript">
					                        var pager = new Pager('tablepaging2', 5);
					                        pager.init();
					                        pager.showPageNav('pager', 'pageNavPosition2');
					                        pager.showPage(1);
                    			</script>
							</div>
							</form>


						</div>

						<div id="tabs-6">
						<%@include file="listDirectorate.jsp" %>
						</div>
					</div>
				</div>

			</div>
		</section>


		<div class="clear"></div>

	</article>

	<!-- End content -->

	<footer> </footer>

	<script>
	
	hideTab3();
/*  	hideTab4();
	hideTab5();
	hideTab6();  */
	
	
	function ValidateData()
	{
			var oName=document.forms["f1"]["org.organisationName"].value;
			var sDes=document.forms["f1"]["org.shortDesc"].value;
			var a1=document.forms["f1"]["org.address1"].value;
			var pCode=document.forms["f1"]["org.postCode"].value;
			var bName = document.forms["f1"]["lu.businessName"].value;
			var p = document.forms["f1"]["org.phoneNumber"].value;
			var e = document.forms["f1"]["org.email"].value;
			var k = true;
			
			var MyPara = "";
			if (oName==null ||oName=="")
				{
					MyPara = MyPara + "Please input the organisation name<br/>  ";
					k = false;
				}
			
			if (sDes==null || sDes=="")
				{
					MyPara = MyPara + "Please input the short description<br/>  ";
					k = false;
				}
			
			if (a1==null || a1=="")
				{
					MyPara = MyPara + "Please input the address line 1<br/>";
					k = false;
				}
			if (pCode==null || pCode=="")
			{
				MyPara = MyPara + "Please input the post code<br/>";
				k = false;
			}
			if (bName==null || bName=="")
			{
				MyPara = MyPara + "Please input the type of business<br/>";
				k = false;
			}
			if (p==null || p=="")
			{
				MyPara = MyPara + "Please input the phone number<br/>  ";
				k = false;
			}
			
			if(p!=null && p!="")
				{
				 if(isNaN(p)|| p.indexOf(" ")!=-1)
					{
				         
				            MyPara = MyPara + "Phone number must be numeric value<br/>";
							k = false;
				    }
				 else if (p.length > 11 || p.length < 10)
					{
				    
				             MyPara = MyPara + "Phone number must be in range 10 or 11 character<br/>";
						     k = false;
				    }
				}
			if ( e!=null && e!="")
			{
			var atpos=e.indexOf("@");
			var dotpos=e.lastIndexOf(".");
			if(atpos<1 || dotpos<atpos+2 || dotpos+2>=e.length)
		  	{
		 		MyPara = MyPara + "Not a valid e-mail address<br/>";
		  		k = false;
		  	}
			}
			
			if(k==false)
				{
					document.getElementById('message').innerHTML=MyPara;
					var myPara = document.getElementById('message');
					myPara.style.color = "red";
				}
			else
				{
					alert("Successfuly");
					document.getElementById('message').innerHTML = "";
					document.forms[0].submit();
					showTab4();
					showTab5();
					showTab6();					
				}
			
	}


	
	function doAction(formName, action) {
/* 		document.forms[formName].action = action;
		document.forms[formName].submit();
 */		
 		alert("abc");
 		
 		//action = "/materialnsp/listSPM!listSupportMaterial";
 		action = "listSPM";
 		window.location = action; 
 	}
	</script>
</body>
</html>